package com.abl.app.controller.mt;

import com.abl.core.common.security.AuthUser;
import com.abl.core.common.util.AuthKit;
import com.abl.core.domain.db.MtRoomApply;
import com.abl.core.domain.project.PageSearch;
import com.abl.core.domain.project.SRS;
import com.abl.core.domain.mt.MtRoomApplyVo;
import com.abl.core.service.mt.MtRoomService;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 移动端会议相关接口
 */
@RestController
@RequestMapping("/app/mt/apply")
public class MtApplyC {

    @Resource
    private MtRoomService mtRoomService;

    //申请会议室资格
    @PostMapping("/add")
    public SRS<Object> add(MtRoomApply mtRoomApply) {
        boolean a = mtRoomService.addApply(mtRoomApply);
        return SRS.bySuccess();
    }


    //查询申请记录
    @PostMapping("/page")
    public SRS<Page<MtRoomApplyVo>> page(MtRoomApplyVo mtRoomApply, PageSearch pageSearch) {
        AuthUser currentUser = AuthKit.mastLogin();
        mtRoomApply.setUserId(currentUser.getUserId());
        return SRS.bySuccess(mtRoomService.page(mtRoomApply, pageSearch));
    }


}
